/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.fp.ui.gui;

/**
 * imports 
 */
import org.fp.logger.*;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;

/**
 * Class to open and put logging exit on an external window. The window is 
 * serializable to avoid open various instances of the logger handler. original 
 * <code>code</code> from Samudra Gupta Aprees Copyright© 2003 ISBN:1590590996.
 * 
 * @author Samudra Gupta
 */
public class LogWindow extends JFrame {
    //local variables
    private int width;
    private int height;
    //window componets
    private JTextArea txtArea = null;
    private JScrollPane jspane = null;
    
    //constructor override
    public LogWindow(String title, int width, int height){
        super(title);
        //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setSize(width, height);
        txtArea = new JTextArea();
        jspane = new JScrollPane(txtArea);
        getContentPane().add(jspane);
        setVisible(true);
        
    } //constructor LogWindow
    
    /**
     * This method serializes the incoming log and append to the text area.
     * @param data the Logging information data.
     */
    public void showInfo(String data){
        txtArea.append(data);
        this.getContentPane().validate();
    }

} //class LogWindow
